<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="Editar Orden"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="" for="orderid" />
                    <h:inputHidden id="orderid" value="0" ></h:inputHidden>
                    
                   
                    <h:outputLabel value="Fecha" for="orderdate" />
                    <h:inputText id="orderdate" value="#{orderOmsController.selected.orderdate}" title="Fecha" required="true" requiredMessage="#{bundle.EditOrderOmsRequiredMessage_orderdate}">
                        <f:convertDateTime pattern="yyy/MM/dd" />
                    </h:inputText>
                    
                    <h:outputLabel value="Precio" for="orderprice" />
                    <h:inputText id="orderprice" value="#{orderOmsController.selected.orderprice}" title="Precio" required="true" requiredMessage="#{bundle.EditOrderOmsRequiredMessage_orderprice}"/>
                    
                    <h:outputLabel value="Origen" for="ordersource" />
                    <h:inputText id="ordersource" value="#{orderOmsController.selected.ordersource}" title="Origen" required="true" requiredMessage="#{bundle.EditOrderOmsRequiredMessage_ordersource}"/>
                    
                     
                    <h:outputLabel value="Comentatrios" for="ordercomments" />
                    <h:inputText id="ordercomments" value="#{orderOmsController.selected.ordercomments}" title="Comentarios" />
                    
                    <h:outputLabel value="Fecha Estimada de Entrega" for="estimateddelivery" />
                    <h:inputText id="estimateddelivery" value="#{orderOmsController.selected.estimateddelivery}" title="Fecha Estimada de Entrega" >
                        <f:convertDateTime pattern="yyyy/MM/dd" />
                    </h:inputText>
                    <h:outputLabel value="Empresa de Entrega" for="shippingcompanyid" />
                    <h:selectOneMenu id="shippingcompanyid" value="#{orderOmsController.selected.shippingcompanyid}" title="Empresa de Entrega" >
                        <f:selectItems value="#{shippingcompanyController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    
                    <h:outputLabel value="Cliente" for="customerid" />
                    <h:inputText id="customerid" value="#{orderOmsController.currentCustomer}" title="Comentarios" disabled="true" />
                    
                    <h:outputLabel value="Direccion" for="addressid" />
                    <h:inputText id="addressid" value="#{orderOmsController.currentAddress}" title="Comentarios"  disabled="true" />
                    
                    <h:outputLabel value="Tarjeta de Credito" for="creditcardid" />
                    <h:inputText id="creditcardid" value="#{orderOmsController.creditCard}" title="Comentarios"  disabled="true" />
                  
                    <h:outputLabel value="Estado" for="orderstatus" />
                    <h:selectOneMenu id="orderstatus" value="#{orderOmsController.selected.orderstatus}" title="Estado" >
                        <f:selectItems value="#{orderOmsController.statusSelectOne}"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                
                <br />
                 <b><label>Cotizaciones</label></b>    
                <br />
                <h:outputText escape="false" value="No se encuentran Cotizaciones" rendered="#{orderOmsController.lstOrderQuoteSize == 0 }"/>
                <h:panelGroup rendered="#{orderOmsController.lstOrderQuoteSize > 0}">
                    <h:dataTable value="#{orderOmsController.lstOrderQuote}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Con Existencias"/>
                            </f:facet>
                            <h:outputText value="SI"  rendered="#{item.hasexistences == 1}" />
                            <h:outputText value="NO"  rendered="#{item.hasexistences != 1}" />
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Seleccionado"/>
                            </f:facet>
                             <h:outputText value="SI"  rendered="#{item.isselected == 1}" />
                            <h:outputText value="NO"   rendered="#{item.isselected != 1}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Valor Cotizacion"/>
                            </f:facet>
                            <h:outputText value="#{item.quoteprice}"/>
                        </h:column>
                       
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Proveedor"/>
                            </f:facet>
                            <h:outputText value="#{item.supplierid.suppliername}"/>
                        </h:column>
                    </h:dataTable>
                </h:panelGroup>
                
                <h:commandLink action="#{orderOmsController.update}" value="Editar"/>
                <br />
                <br />
                <h:commandLink action="#{orderOmsController.viewDetail}" value="Ver Detalle"/>   
                <br />
                <br />
                <h:commandLink action="View" value="Ver Orden" immediate="true"/>
                <br />
                <br />
                <h:commandLink action="#{orderOmsController.prepareList}" value="Ver Ordenes" immediate="true"/>
                <br />
                <br />
                <h:commandLink value="Ir a Menu Inicial" action="/index" immediate="true" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
